<div class="row content-nav">
    <div class="col-xs-12">
        <ul>
            <li><a href="javascript:;"><i></i>财务管理</a></li>
            <li><a href="javascript:;">流水记录</a></li>
        </ul>
    </div>
</div>
<div class="layui-fluid" id="search-box">
    <div class="layui-card">
        <div class="layui-card-body">
            <form class="layui-form layui-form-pane" action="">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label seller-inline-2">类型：</label>
                        <div class="layui-input-inline seller-inline-4">
                            <select name="type">
                                <option value="">全部</option>
                                 {if !empty($type_list)}
                                  {volist name="type_list" id="item" }
                                    <option value="{$key}">{$item}</option>
                                  {/volist}
                                 {/if}
                            </select>   
                        </div>
                    </div>                    
                    <div class="layui-inline">
                        <label class="layui-form-label seller-inline-2">用户账号：</label>
                        <div class="layui-input-inline seller-inline-4">
                            <input type="text" name="username" placeholder="请输入用户账号" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                      <label class="layui-form-label">发生时间</label>
                      <div class="layui-input-inline" style="width:300px;">
                        <input type="text" class="layui-input" id="create_time" name="create_time" placeholder=" - ">
                      </div>
                    </div>                  
                    
                    <div class="layui-inline">
                        <button type="button" id="search-btn" class="layui-btn layui-btn-sm layui-bg-light-blue"><i class="layui-icon layui-icon-search"></i> 搜索</button>
                    </div>                    
                </div>
            </form>
        </div>
    </div>
</div>
<section class="content clearfix">
    <div class="layui-list-box">
        <table class="layui-hide" id="list-box" lay-filter="list-box"></table>
    </div>
</section>

<script type="text/html" id="list-toolbar">
    <div class="layui-btn-container">
        <button lay-event="refresh" type="button" class="layui-btn layui-btn-sm layui-bg-red"><i class="layui-icon">&#xe9aa;</i> 刷新</button>
    </div>
</script>

<script type="text/html" id="list-bar">
    {{# if(d.status == 0){ }}
    <a class="layui-btn layui-btn-xs" lay-event="handle">待处理</a>
    {{# } }}

    {{# if(d.status != 0){ }}
    <a class="layui-btn layui-btn-xs layui-btn-danger">己处理</a>
    {{# } }}
</script>

<style type="text/css">.layui-table-cell{ height:auto !important; } </style>
<script>
layui.use(['table','form','laydate'], function () {
    var table = layui.table;
    var form = layui.form;
    var laydate = layui.laydate;
    laydate.render({
        elem: '#create_time'
        ,type: 'datetime'
        ,range: '~'
    });  
    table.render({
        elem: '#list-box'
        , url: '{:createUrl("walletDetail")}'
        , toolbar: '#list-toolbar'
        , defaultToolbar: []
        , title: '数据表'
        , cols: [[
                  {type: 'checkbox'}
                , {field: 'username', title: '会员名称',width:150}
                , {field: 'resaon', title: '类型'}
                , {field: 'amount', title: '发生金额',width:150,align:'center'}                
                , {field: 'create_time_text', title: '发生时间',width:180,align:'center'}
                // , {align: 'center', title: '操作', toolbar: '#list-bar', width: 80}
        
            ]]
        , page: true
        , id: 'list-table'
        , height: 'full-200'
        // ,limit:30
    });

    //头工具栏事件
    table.on('toolbar(list-box)', function (obj) {
        switch (obj.event) {
            case 'refresh':
                window.location.reload();
                break;
        }
    });

    //监听行工具事件
    table.on('tool(list-box)', function (obj) {
        var data = obj.data;
        if (obj.event === 'handle') {
            layer.open({
                type: 2,
                title: '提现管理',
                shadeClose: true,
                shade: 0.3,
                area: ['60%', '80%'],
                content: '{:createUrl("handle")}?id='+data.id
            });
        }
    });

    $("#search-btn").on("click",function (){
        //执行重载
        table.reload('list-table', {
          page: {
            curr: 1
          }
          ,where: {
            key: {
              type : $('[name="type"]').val(),
              username : $('[name="username"]').val(),
              create_time : $('[name="create_time"]').val()
            }
          }
        }, 'data');
    });       
});
</script>





